<?php 
namespace Home\Controller;
use Think\Controller;
class CartController extends BaseController{
	function cart(){
		$cartOb=M('Cart');
		$addrOb=M('Address');
		$arr=$cartOb->where("cart_user_name='{$_SESSION['user_name']}'")->select();
		$re=$addrOb->where("address_pid='0'")->select();
		$this->assign('re',$re);
		$this->assign('arr',$arr);
		$this->display();
	}
	function cart_del(){
	    $cartOb=M('Cart');
	    $arr=$cartOb->where("cart_id='{$_POST['id']}'")->delete();
	    if ($arr){
	        $this->ajaxReturn(1);
        }else{
	        $this->ajaxReturn(0);
        }
    }
    function refer_one(){
	    $addrOb=M('Address');
	    $type_one=$addrOb->where("address_pid='{$_POST['id']}'")->select();
	    if ($type_one){
	        $this->ajaxReturn(1);
        }
    }
}